import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: happyiu
 * Date: 2021-10-24
 * Time: 15:02
 */
public class TestDemo {




    

    public static void main4(String[] args) {

        System.out.println("Hello world");
    }

    public static int Maxnum(int [] array){
        if(array == null || array.length == 0){
            return -1;
        }
        int max = array[0];
        for (int i = 1; i < array.length; i++) {
            if(max<array[i]) {
                max = array[i];
            }
        }
        return max;
    }

    public static String myTostring2(int []array){
        if(array == null){
            return "null";
        }
        String str ="[";
        for (int i = 0; i < array.length; i++) {
            str = str + array[i];
            if(i<array.length-1){
                str = str + ",";
            }
        }
        str = str + "]";
        return str;
    }

    public static void myTostring(int []array){
        System.out.print("[");
        for (int i = 0; i < array.length; i++) {
            System.out.print(array[i]);
            if(i< array.length-1) {
                System.out.print(",");
            }
        }
        System.out.print("]");

    }//[1,2,3,4,5]

    public static void main3(String[] args) {
        int [] array={1,2,3,4,5,66};
       myTostring(array);
       System.out.println();
       System.out.print(myTostring2(array));
       System.out.println();
       System.out.println(Maxnum(array));
    }


public static void func (int [] array){
    for (int i = 0; i < array.length; i++) {
        array[i]= array[i]+5;
    }
}

    public static void main2(String[] args) {
        int[] array = {1,2,3,4,5};
        func(array);
        System.out.println(Arrays.toString(array));
    }



    public static void main1(String[] args) {
        int[] array = null;
//        System.out.println(array[0]);

    }


}
